package com.community.web.master.controller;


import com.community.common.result.Result;
import com.community.model.entity.Visitor;
import com.community.web.master.domain.dto.PageAreaDto;
import com.community.web.master.domain.dto.PageVisitorDto;
import com.community.web.master.domain.vo.PageResult;
import com.community.web.master.service.IVisitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 李晶
 * @since 2024-07-02
 */
@RestController
@RequestMapping("/master/visitor")
@Api(tags = "访客接口")
@Slf4j
public class VisitorController {
    @Autowired
    private IVisitorService iVisitorService;

    @GetMapping("/pageQuery")
    @ApiOperation("访客分页查询")
    public Result<PageResult> pageQuery(PageVisitorDto pageVisitorDto){
        log.info("分页查询"+pageVisitorDto);
        PageResult pageResult= iVisitorService.pageQuery(pageVisitorDto);
        return Result.success(pageResult);
    }

    @PutMapping("/{id}")
    @ApiOperation("更新来访状态")
    public Result updateStatus(@PathVariable Integer id){
        log.info("更新来访状态"+id);
        iVisitorService.updateStatus(id);
        return Result.success();
    }
}
